<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script>
        $(function() {
            var $div = $("div").children();
            $div.each(function() {
                alert($(this).text());
            });
        });
    </script>
    <style>

    </style>
</head>

<body>
    <div>
        <p>水电费水电费</p>
        <p>sdfsdf
            <p>杀对方水电费</p>
        </p>
        <h2>撒的发生</h2>
    </div>
</body>

</html>